package com.ruoyi.hk.hanler.exception;

import lombok.Getter;

@Getter
public class HBusinessException extends RuntimeException {

    //自定义结果接口
    private ResultCode resultCode ;

    public HBusinessException(ResultCode resultCode) {
        super(resultCode.getMsg()); // 调用父类构造函数，设置异常消息
        this.resultCode = resultCode;
    }
    
    // 重写 getMessage 方法，确保返回有意义的错误信息
    @Override
    public String getMessage() {
        return resultCode != null ? resultCode.getMsg() : super.getMessage();
    }
}
